<template>
<h3 class="tit">{{title}}</h3>
<div v-for="(item,index) in ageList">{{item}}</div>
<button @click="clickEmit">字传父</button>
</template>
<script setup lang="ts">
// defineProps({
//     title:{
//         type: String,
//         require: true,
//         default:()=>{
//             return ''
//         }
//     }
// })
import {onMounted} from "vue";

const clickEmit = ()=>{
    emits('parentClick','asdda')
}
// const emits = defineEmits(['parentClick'])
const emits = defineEmits<{
    (e:'parentClick',data:string):void
}>()

type props = {
    title:string,
    ageList:Array<number>
}
const props = withDefaults(defineProps<props>(),{
    title: 'hello',
    ageList:()=>[]
})
const getList=()=>{
    console.log('chuild')
}
onMounted(()=>{
  console.log(props.ageList)
})
defineExpose({
    getList
})
</script>
<style lang="scss">
.tit {
  height: 32px;
  line-height: 32px;
}
.pie-chart {
    width: 100%;
    height: 90%;
}
</style>
